//
//  UIView+LBFrame.m
//  TEXT
//
//  Created by mac on 2025/3/30.
//  Copyright © 2025 刘博. All rights reserved.
//

#import "UIView+LBFrame.h"

@implementation UIView (LBFrame)

- (CGFloat)x {
    return self.frame.origin.x;
}

- (void)setX:(CGFloat)x {
    CGRect newFrame   = self.frame;
    newFrame.origin.x = x;
    self.frame        = newFrame;
}

- (CGFloat)y {
    return self.frame.origin.y;
}

- (void)setY:(CGFloat)zf_y {
    CGRect newFrame   = self.frame;
    newFrame.origin.y = zf_y;
    self.frame        = newFrame;
}

- (CGFloat)width {
    return CGRectGetWidth(self.bounds);
}

- (void)setWidth:(CGFloat)zf_width {
    CGRect newFrame     = self.frame;
    newFrame.size.width = zf_width;
    self.frame          = newFrame;
}

- (CGFloat)height {
    return CGRectGetHeight(self.bounds);
}

- (void)setHeight:(CGFloat)zf_height {
    CGRect newFrame      = self.frame;
    newFrame.size.height = zf_height;
    self.frame           = newFrame;
}

- (CGFloat)top {
    return self.frame.origin.y;
}

- (void)setTop:(CGFloat)zf_top {
    CGRect newFrame   = self.frame;
    newFrame.origin.y = zf_top;
    self.frame        = newFrame;
}

- (CGFloat)bottom {
    return self.frame.origin.y + self.frame.size.height;
}

- (void)setBottom:(CGFloat)zf_bottom {
    CGRect newFrame   = self.frame;
    newFrame.origin.y = zf_bottom - self.frame.size.height;
    self.frame        = newFrame;
}

- (CGFloat)left {
    return self.frame.origin.x;
}

- (void)setLeft:(CGFloat)zf_left {
    CGRect newFrame   = self.frame;
    newFrame.origin.x = zf_left;
    self.frame        = newFrame;
}

- (CGFloat)right {
    return self.frame.origin.x + self.frame.size.width;
}

- (void)setRight:(CGFloat)zf_right {
    CGRect newFrame   = self.frame;
    newFrame.origin.x = zf_right - self.frame.size.width;
    self.frame        = newFrame;
}

- (CGFloat)centerX {
    return self.center.x;
}

- (void)setCenterX:(CGFloat)zf_centerX {
    CGPoint newCenter = self.center;
    newCenter.x       = zf_centerX;
    self.center       = newCenter;
}

- (CGFloat)centerY {
    return self.center.y;
}

- (void)setCenterY:(CGFloat)zf_centerY {
    CGPoint newCenter = self.center;
    newCenter.y       = zf_centerY;
    self.center       = newCenter;
}

- (CGPoint)origin {
    return self.frame.origin;
}

- (void)setOrigin:(CGPoint)zf_origin {
    CGRect newFrame = self.frame;
    newFrame.origin = zf_origin;
    self.frame      = newFrame;
}

- (CGSize)size {
    return self.frame.size;
}

- (void)setSize:(CGSize)zf_size {
    CGRect newFrame = self.frame;
    newFrame.size   = zf_size;
    self.frame      = newFrame;
}

@end
